﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <WtmSearcher v-model="searchDataPassStationRecord" @search="()=>{getTableDataPassStationRecord();}">
      <el-row>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="LineCode_FormItem" prop="LineCode" :label="$t('message.autotrans._Model_PassStationRecord_lineCode')">
            <el-input v-model="searchDataPassStationRecord.LineCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="MaterialCode_FormItem" prop="MaterialCode" :label="$t('message.autotrans._Model_PassStationRecord_materialCode')">
            <el-input v-model="searchDataPassStationRecord.MaterialCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="MaterialName_FormItem" prop="MaterialName" :label="$t('message.autotrans._Model_PassStationRecord_materialName')">
            <el-input v-model="searchDataPassStationRecord.MaterialName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="MaterialVersion_FormItem" prop="MaterialVersion" :label="$t('message.autotrans._Model_PassStationRecord_materialVersion')">
            <el-input v-model="searchDataPassStationRecord.MaterialVersion" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="OperationCode_FormItem" prop="OperationCode" :label="$t('message.autotrans._Model_PassStationRecord_operationCode')">
            <el-input v-model="searchDataPassStationRecord.OperationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="OrderCode_FormItem" prop="OrderCode" :label="$t('message.autotrans._Model_PassStationRecord_orderCode')">
            <el-input v-model="searchDataPassStationRecord.OrderCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="PassBeginTime_FormItem" prop="PassBeginTime" :label="$t('message.autotrans._Model_PassStationRecord_passBeginTime')">
            <el-input v-model="searchDataPassStationRecord.PassBeginTime" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="PassEndTime_FormItem" prop="PassEndTime" :label="$t('message.autotrans._Model_PassStationRecord_passEndTime')">
            <el-input v-model="searchDataPassStationRecord.PassEndTime" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="PassStatus_FormItem" prop="PassStatus" :label="$t('message.autotrans._Model_PassStationRecord_passStatus')">
            <el-input v-model="searchDataPassStationRecord.PassStatus" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ScheduleCode_FormItem" prop="ScheduleCode" :label="$t('message.autotrans._Model_PassStationRecord_scheduleCode')">
            <el-input v-model="searchDataPassStationRecord.ScheduleCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="SnNumber_FormItem" prop="SnNumber" :label="$t('message.autotrans._Model_PassStationRecord_snNumber')">
            <el-input v-model="searchDataPassStationRecord.SnNumber" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="StationCode_FormItem" prop="StationCode" :label="$t('message.autotrans._Model_PassStationRecord_stationCode')">
            <el-input v-model="searchDataPassStationRecord.StationCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ShipCode_FormItem" prop="ShipCode" :label="$t('message.autotrans._Model_PassStationRecord_shipCode')">
            <el-input v-model="searchDataPassStationRecord.ShipCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="MachineCode_FormItem" prop="MachineCode" :label="$t('message.autotrans._Model_PassStationRecord_machineCode')">
            <el-input v-model="searchDataPassStationRecord.MachineCode" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="Uploadflag_FormItem" prop="Uploadflag" :label="$t('message.autotrans._Model_PassStationRecord_uploadflag')">
            <el-select v-model="searchDataPassStationRecord.Uploadflag" clearable>
               <el-option :key="1" :value=true :label="$t('message._system.common.vm.tips_bool_true')"></el-option>
               <el-option :key="0" :value=false :label="$t('message._system.common.vm.tips_bool_false')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="UserId_FormItem" prop="UserId" :label="$t('message.autotrans._Model_PassStationRecord_userId')">
            <el-input v-model="searchDataPassStationRecord.UserId" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="UserName_FormItem" prop="UserName" :label="$t('message.autotrans._Model_PassStationRecord_userName')">
            <el-input v-model="searchDataPassStationRecord.UserName" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="IsProduct_FormItem" prop="IsProduct" :label="$t('message.autotrans._Model_PassStationRecord_isProduct')">
            <el-input v-model="searchDataPassStationRecord.IsProduct" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="ReqType_FormItem" prop="ReqType" :label="$t('message.autotrans._Model_PassStationRecord_reqType')">
            <el-input v-model="searchDataPassStationRecord.ReqType" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="CreateTime_FormItem" prop="CreateTime" :label="$t('message.autotrans._Model_PassStationRecord_CreateTime')">
            <el-date-picker v-model="searchDataPassStationRecord.CreateTime" type='daterange' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="UpdateTime_FormItem" prop="UpdateTime" :label="$t('message.autotrans._Model_PassStationRecord_UpdateTime')">
            <el-date-picker v-model="searchDataPassStationRecord.UpdateTime" type='daterange' clearable></el-date-picker>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="CreateBy_FormItem" prop="CreateBy" :label="$t('message.autotrans._Model_PassStationRecord_CreateBy')">
            <el-input v-model="searchDataPassStationRecord.CreateBy" clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="8" class="mb20">
        <el-form-item ref="UpdateBy_FormItem" prop="UpdateBy" :label="$t('message.autotrans._Model_PassStationRecord_UpdateBy')">
            <el-input v-model="searchDataPassStationRecord.UpdateBy" clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

  </WtmSearcher>

  <div style="text-align: right;">
      <WtmButton v-auth="'/api/Record/PassStationRecord/Create'" icon='fa fa-plus' type='primary' :button-text="$t('message.autotrans.SysCreate')" @click="OnCreateClick()"/>
    <WtmButton v-auth="'/api/Record/PassStationRecord/BatchDelete'"  icon='fa fa-trash' type='danger' :button-text="$t('message.autotrans.SysDelete')" :confirm="$t('message._system.common.vm.deletetip')" @click="onBatchDelete()"/>
    <WtmButton v-auth="'/api/Record/PassStationRecord/BatchEdit'" icon='fa fa-pencil-square' type='primary' :button-text="$t('message.autotrans.SysBatchEdit')" @click="OnBatchEditClick()"/>
    <WtmButton v-auth="'/api/Record/PassStationRecord/Import'" icon='fa fa-tasks' type='primary' :button-text="$t('message.autotrans.SysImport')" @click="OnImportClick()"/>
    <WtmButton v-auth="'/api/Record/PassStationRecord/PassStationRecordExportExcel'"  icon='fa fa-arrow-circle-down' type='primary' :button-text="$t('message.autotrans.SysExport')" @click="onExport()"/>

  </div>
  <WtmTable ref="tableRefPassStationRecord" v-bind="tableDataPassStationRecord">
    <template #operation>
      <el-table-column :label="$t('message._system.common.vm.operate')" width="180">
        <template v-slot="scope">
            <route-link @click="jump(scope.row)">
            <el-button text type="primary">关联信息</el-button>
            </route-link>
            &nbsp;
            <WtmButton v-auth="'/api/Record/PassStationRecord/Edit'" :is-text="true" icon='fa fa-pencil-square' type='warning' :button-text="$t('message.autotrans.SysEdit')" @click="OnEditrowClick(scope.row)"/>
          <WtmButton v-auth="'/api/Record/PassStationRecord/{id}'" :is-text="true" icon='fa fa-info-circle' type='info' :button-text="$t('message.autotrans.Page详情')" @click="OnDetailsrowClick(scope.row)"/>
          <WtmButton v-auth="'/api/Record/PassStationRecord/BatchDelete'"  icon='fa fa-trash' type='danger' :button-text="$t('message.autotrans.SysDelete')" :confirm="$t('message._system.common.vm.deletetip')" :is-text="true"  @click="onDelete(scope.row)"/>

        </template>
      </el-table-column>
    </template>
  </WtmTable>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageRecordPassStationRecordIndex;true;TyMES.Record.Controllers;PassStationRecord">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { passstationrecordApi } from '/@/api/record/passstationrecord';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;

const CreateDialog = defineAsyncComponent(() => import('./create.vue'));
const EditDialog = defineAsyncComponent(() => import('./edit.vue'));
const DetailsDialog = defineAsyncComponent(() => import('./details.vue'));
const BatchEditDialog = defineAsyncComponent(() => import('./batchedit.vue'));
const ImportDialog = defineAsyncComponent(() => import('./import.vue'));

const statePassStationRecord = reactive({
    
});

const router = useRouter();
const jump = (row:any)=>{
    console.log("dd",row.PassStationRecord_snNumber)
router.push({
    path:'/record/materialbindrecord',
    query:{
        snNumber:row.PassStationRecord_snNumber
    }
})
}

const searchDataPassStationRecord = ref({
        LineCode: '',
        MaterialCode: '',
        MaterialName: '',
        MaterialVersion: '',
        OperationCode: '',
        OrderCode: '',
        PassBeginTime: '',
        PassEndTime: '',
        PassStatus: '',
        ScheduleCode: '',
        SnNumber: '',
        StationCode: '',
        ShipCode: '',
        MachineCode: '',
        Uploadflag: undefined,
        UserId: '',
        UserName: '',
        IsProduct: '',
        ReqType: '',
        CreateTime: undefined,
        UpdateTime: undefined,
        CreateBy: '',
        UpdateBy: '',
});

// 定义变量内容
const tableRefPassStationRecord = ref();
const tableDataPassStationRecord = ref({
    // 列表数据（必传）
    data: [],
	// 表头内容（必传，注意格式）
	header: [
      {title:ci.proxy.$t('message.autotrans.Page产线编码'),key: 'PassStationRecord_lineCode',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.Page物料编码'),key: 'PassStationRecord_materialCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page物料名称'),key: 'PassStationRecord_materialName',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.Page物料版本'),key: 'PassStationRecord_materialVersion',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.Page工序编码'),key: 'PassStationRecord_operationCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工单编码'),key: 'PassStationRecord_orderCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page进站时间'),key: 'PassStationRecord_passBeginTime',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page出站时间'),key: 'PassStationRecord_passEndTime',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page过站状态'),key: 'PassStationRecord_passStatus',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.Page排程编号'),key: 'PassStationRecord_scheduleCode',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.PageSN'),key: 'PassStationRecord_snNumber',type: 'text',isCheck: true},
      {title:ci.proxy.$t('message.autotrans.Page工位编号'),key: 'PassStationRecord_stationCode',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.Page出货条码'),key: 'PassStationRecord_shipCode',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.Page设备号'),key: 'PassStationRecord_machineCode',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.Page上传工厂mes标志'),key: 'PassStationRecord_uploadflag',type: 'switch',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.PageuserId'),key: 'PassStationRecord_userId',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.PageuserName'),key: 'PassStationRecord_userName',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.Page出货标识'),key: 'PassStationRecord_isProduct',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans.Page进出站标识'),key: 'PassStationRecord_reqType',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans._AdminCreateTime'),key: 'PassStationRecord_CreateTime',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans._AdminUpdateTime'),key: 'PassStationRecord_UpdateTime',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans._AdminCreateBy'),key: 'PassStationRecord_CreateBy',type: 'text',isCheck: true},
    //   {title:ci.proxy.$t('message.autotrans._AdminUpdateBy'),key: 'PassStationRecord_UpdateBy',type: 'text',isCheck: true},

	],
	// 配置项（必传）
	config: {
        total: 0, // 列表总数
		loading: true, // loading 加载
		isSerialNo: true, // 是否显示表格序号
		isSelection: true, // 是否显示表格多选
		isOperate: true, // 是否显示表格操作栏
	}
});
// 初始化表格数据
const getTableDataPassStationRecord = () => {
    tableRefPassStationRecord.value.doSearch(passstationrecordApi().search, searchDataPassStationRecord.value)
        .catch((error: any) => {
			other.setFormError(ci, error);
		});
};
const OnCreateClick = () => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysCreate'), CreateDialog, null, getTableDataPassStationRecord)
};

const OnEditrowClick = (row: any) => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysEdit'), EditDialog, row, getTableDataPassStationRecord)
};

const OnDetailsrowClick = (row: any) => {
    other.openDialog(ci.proxy.$t('message.autotrans.Page详情'), DetailsDialog, row, getTableDataPassStationRecord)
};

// 删除
const onDelete = (row: any) => {
    passstationrecordApi().delete([row.ID]).then(() => { getTableDataPassStationRecord()})
};

const onBatchDelete = () => {
    const selectedrows = tableRefPassStationRecord.value.getSelectedRows();
    const selectedids = selectedrows.map((x: any) => x.ID);
    if (selectedids.length > 0)
      passstationrecordApi().delete(selectedids).then(() => { getTableDataPassStationRecord()})
    else
      ElMessage.error(ci.proxy.$t('message._system.common.vm.check'));
};

const OnBatchEditClick = () => {
    const selectedrows = tableRefPassStationRecord.value.getSelectedRows();
    const selectedids = selectedrows.map((x: any) => x.ID);
    if (selectedids.length > 0)
      other.openDialog(ci.proxy.$t('message.autotrans.SysBatchEdit'), BatchEditDialog, selectedids, getTableDataPassStationRecord)
    else
      ElMessage.error(ci.proxy.$t('message._system.common.vm.check'));
};

const OnImportClick = () => {
    other.openDialog(ci.proxy.$t('message.autotrans.SysImport'), ImportDialog, null, getTableDataPassStationRecord)
};

const onExport = () => {
	const selected = tableRefPassStationRecord.value.getSelectedRows();
	if (selected.length > 0) {
		passstationrecordApi().exportById(selected.map((x: any) => x.ID));
	}
	else {
		passstationrecordApi().export(searchDataPassStationRecord.value);
	}
};

// 页面加载时
onMounted(() => {
    
        getTableDataPassStationRecord();

});

// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

